﻿//----------------------------------------------------------------
// Desc: 
// Edit: ShowLong, http://blog.csdn.net/showlong
//
// Date Created: 2012-04-13
//
// Update Date : 
//
// Copyright (c) Fuel4D (http://www.fuel4d.com), All rights reserved.
//
//     注意：WINDOWS环境下默认使用UNICODE（UTF16LE），安卓和IOS使用UTF8编码
//           所有代码CPP和H文件使用UTF-8存储
//----------------------------------------------------------------
#pragma once


//----------------------------------------------------------------
// 数据类型定义
//----------------------------------------------------------------
typedef char                    ACHAR;
typedef wchar_t                 WCHAR;
#ifdef UNICODE
typedef WCHAR                   TCHAR;
#else
typedef ACHAR                   TCHAR;
typedef unsigned short          DCHAR;
#endif
typedef TCHAR                   NCHAR;

typedef char                    CHAR;
typedef unsigned char           UCHAR;
typedef short                   SHORT;
typedef unsigned short          USHORT;
typedef int                     INT;
typedef unsigned int            UINT;
typedef long                    LONG;
typedef unsigned long           ULONG;
typedef long long               INT64;
typedef unsigned long long      UINT64;
typedef float                   FLOAT;
typedef double                  DOUBLE;

typedef signed char             SINT8;
typedef unsigned char           UINT8;
typedef signed short            SINT16;
typedef unsigned short          UINT16;
typedef signed int              SINT32;
typedef unsigned int            UINT32;
typedef signed long long        SINT64;

typedef unsigned char           BYTE;       // 单字节
typedef unsigned short          WORD;       // 双字节
typedef unsigned long           DWORD;      // 四字节
typedef unsigned long long      QWORD;      // 八字节

typedef int                     INT_PTR;
typedef unsigned int            UINT_PTR;
typedef long                    LONG_PTR;
typedef unsigned long           ULONG_PTR;
typedef unsigned long           DWORD_PTR;

typedef UINT_PTR                WPARAM;
typedef LONG_PTR                LPARAM;

typedef unsigned char           uchar;
typedef unsigned short          ushort;
typedef unsigned int            uint;
typedef unsigned long           ulong;
typedef unsigned long long      ulonglong;

typedef signed char             int8;
typedef unsigned char           uint8;
typedef signed short            int16;
typedef unsigned short          uint16;
typedef signed int              int32;
typedef unsigned int            uint32;
typedef signed long long        int64;
typedef unsigned long long      uint64;

#ifndef BOOL
typedef int                     BOOL;
#endif

#ifdef WIN32
typedef WCHAR                   FTCHAR;
typedef WCHAR                   FFCHAR;
#else
typedef ACHAR                   FTCHAR;
typedef ACHAR                   FFCHAR;
#endif


//----------------------------------------------------------------
// 自定义
//----------------------------------------------------------------
typedef unsigned long           FIDHASH;    // 32位的HASH值
typedef unsigned long long      FIDHASH64;  // 64位的HASH值
typedef int                     FTIME_T;

typedef unsigned long long      FDATA_ID;
typedef unsigned char           FDATA_KEY;
typedef unsigned int            FDATA_INDEX;


//----------------------------------------------------------------
// 链接对应库
//----------------------------------------------------------------
#ifdef _DEBUG
#define FLIB(x)                 x"D.lib"
#else
#define FLIB(x)                 x".lib"
#endif


//----------------------------------------------------------------
// 基础功能符号
//----------------------------------------------------------------
#define _FTW(x)                 L##x
#define _FTA(x)                 x
#define _FNILW                  L""
#define _FNILA                  ""
#define _FENDW                  L'\0'
#define _FENDA                  '\0'

#define _FMACRO_COV(x)          _FTW(x)
#define _FFILEW_                _FMACRO_COV(__FILE__)
#define _FFUNCW_                _FMACRO_COV(__FUNCTION__)
#define _FLINEW_                __LINE__
#define _FDATEW_                _FMACRO_COV(__DATE__)
#define _FTIMEW_                _FMACRO_COV(__TIME__)

#define _FFILEA_                __FILE__
#define _FFUNCA_                __FUNCTION__
#define _FLINEA_                __LINE__
#define _FDATEA_                __DATE__
#define _FTIMEA_                __TIME__

#ifdef UNICODE
#define _FT                     _FTW
#define _FNIL                   _FNILW
#define _FEND                   _FENDW
#define _FFILE_                 _FFILEW_
#define _FFUNC_                 _FFUNCW_
#define _FLINE_                 _FLINEW_
#define _FDATE_                 _FDATEW_
#define _FTIME_                 _FTIMEW_
#else
#define _FT                     _FTA
#define _FNIL                   _FNILA
#define _FEND                   _FENDA
#define _FFILE_                 _FFILEA_
#define _FFUNC_                 _FFUNCA_
#define _FLINE_                 _FLINEA_
#define _FDATE_                 _FDATEA_
#define _FTIME_                 _FTIMEA_
#endif

#ifdef WIN32
#define _FFT                    _FTW
#define _FFNIL                  _FNILW
#define _FFEND                  _FENDW
#define _FFFILE_                _FFILEW_
#define _FFFUNC_                _FFUNCW_
#define _FFLINE_                _FLINEW_
#define _FFDATE_                _FDATEW_
#define _FFTIME_                _FTIMEW_
#else
#define _FFT                    _FTA
#define _FFNIL                  _FNILA
#define _FFEND                  _FENDA
#define _FFFILE_                _FFILEA_
#define _FFFUNC_                _FFUNCA_
#define _FFLINE_                _FLINEA_
#define _FFDATE_                _FDATEA_
#define _FFTIME_                _FTIMEA_
#endif

#define TRUE                    1
#define FALSE                   0
#define MAX_PATH                260
#define _MAX_PATH               260 /* max. length of full pathname */
#define _MAX_DRIVE              3   /* max. length of drive component */
#define _MAX_DIR                256 /* max. length of path component */
#define _MAX_FNAME              256 /* max. length of file name component */
#define _MAX_EXT                256 /* max. length of extension component */